%{
#include <stdio.h>
#include <string.h>
#include <err.h>

#include "tfs_conf.h"

#define YYSTYPE     char *

void yyerror(const char *msg);
int yylex(void);

int yywrap()
{
    return 1;
} 

%}

%token WORD NUMBER EQUALS OBRACKET EBRACKET

%%
commands: /* empty */
        |
    commands command
    ;

command:
    tfs_stanza
    {
        POOL_FINISH();
    }
    ;

tfs_stanza:
    tfs_pool tfs_params
    ;

tfs_pool:
    OBRACKET WORD EBRACKET
    {
        POOL_ALLOC(); 
        POOL_SET("pool", $2, T_WORD);
    }
    ;

tfs_params:
          |
    tfs_params tfs_param
          |
    tfs_params tfs_number
    ;

tfs_param:
    WORD EQUALS WORD
    {
        POOL_SET($1, $3, T_WORD);
    }
    ;

tfs_number:
    WORD EQUALS NUMBER
    {
        POOL_SET($1, $3, T_NUM);
    }
    ;

%%
